|
|
|
|
|
|
|
Dim KeyIndex As Long
Dim keybuffer As String
Dim KeyCollection As New Collection
Dim currentkey As clsKeyValues
Dim nulloffset As Long
Dim NewKey As Long
res = GetKeyInfo3(hKey, NumberOfSubKeys, MaxSubKeyLength)
If res <> 0 Then
Exit Function
End If
keybuffer = String$(MaxSubKeyLength + 1, 0)
For KeyIndex = 0 To NumberOfSubKeys - 1
res = RegEnumKey(hKey, KeyIndex, keybuffer, MaxSubKeyLength + 1)
If res = 0 Then
Set currentkey = New clsKeyValues
nulloffset = InStr(keybuffer, Chr$(0))
currentkey.KeyName = Left$(keybuffer, nulloffset - 1)
' Enumerate values here
' Open the subkey
res = RegOpenKeyEx(hKey, currentkey.KeyName, 0, KEY_READ, NewKey)
' Get a collection containing the subvalues
Set currentkey.ValueNames = EnumerateValues(NewKey)
' Close the subkey
Call RegCloseKey(NewKey)
KeyCollection.Add currentkey
End If
Next KeyIndex
Set EnumerateKeys = KeyCollection
End Function |
|
|
|
|
|
|
|
|
The RegEnumValue function is somewhat more flexible than the RegEnumKey function, in that it is able to retrieve the data for each value during the enumeration. We won't take advantage of this feature at this time, in order to keep things simple. As with the RegQueryInfoKey function, you can simply pass a NULL pointer to this function for those parameters you do not wish to use. In this case, the lpType, lpData, and lpcbData parameters will be set to NULL. Once you've |
|
|
|
|
|